package com.palnar.ilecker.model;

import java.io.Serializable;
import java.util.HashMap;

import org.ksoap2.serialization.SoapObject;


public class Ingredient extends ItemBase implements Serializable {
		
	private int clientId;
	private int serverId;
	private byte[] image;
	private int ingredientGroupServerId;
	private int ingredientGroupClientId;
	
	public Ingredient() {
	}

	public Ingredient(String ingredientname) {
		//this.name = ingredientname;
	}

//	public String getName() {
//		return this.name;
//	}

	public int getClientId() {
		return this.clientId;
	}
	
	public int getServerId() {
		return this.serverId;
	}

	public int GetIngredientGroupClientId()
	{
		return this.ingredientGroupClientId;
	}

	public void SetIngredientGroupClientId(int ingredientGroupClientId)
	{
		this.ingredientGroupClientId = ingredientGroupClientId;
	}

	public int GetIngredientGroupServerId()
	{
		return this.ingredientGroupServerId;
	}

	public void SetIngredientGroupServerId(int ingredientGroupServerId)
	{
		this.ingredientGroupServerId = ingredientGroupServerId;
	}
	
	public byte[] getImage() {
		return this.image;
	}
	

//	public void SetName(String name) {
//		this.name = name;
//	}

	public void setClientId(int id) {
		this.clientId = id;
	}
	
	public void setServerId(int id) {
		this.serverId = id;
	}
	
	public void setImage(byte[] image) {
		this.image= image;			
	}


	public static Ingredient IngredientBuilder(SoapObject outputSoapObject, HashMap<Integer, Language> languages)
	{		
		Ingredient ingredient = new Ingredient();
		if(outputSoapObject.getPropertyCount()>0)
		{
		ingredient.serverId = Integer.parseInt(outputSoapObject.getProperty("Id")
				.toString());
		ingredient.ingredientGroupServerId = Integer.parseInt(outputSoapObject.getProperty("IngredientGroupId")
				.toString());
			if (outputSoapObject.getProperty("Name") != null)
			{
				ingredient.setName(Integer.parseInt(outputSoapObject.getProperty("Name").toString()));
			}
		}


//		SoapObject ingredientDetailsNameSoapObject = (SoapObject)outputSoapObject.getProperty("DisplayNames");
//		ingredient.TextNameBuilder(ingredientDetailsNameSoapObject, languages);
	
		return ingredient;
	}
}
